package com.vortex.cloud.zhsw.xinyang.service;

import com.vortex.cloud.zhsw.xinyang.dto.DictDataDTO;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * @Description
 * @Author ChenY
 * @Date 2022/5/9 15:30
 **/
public interface EhcacheDemoService {

    /**
     *  更新
     * @param tenantId
     * @param value
     */
    @CacheEvict(cacheNames="SAMPLE_TEST1", key = "#tenantId")
    void update(String tenantId,String value);

    /**
     *  获取
     * @param tenantId
     * @return
     */
    @Cacheable(cacheNames = "SAMPLE_TEST1", key = "#tenantId")
    String get(String tenantId);

    /**
     *  更新集合
     * @param tenantId
     * @param value
     */
    @CacheEvict(cacheNames="SAMPLE_TEST2", key = "#tenantId")
    void updateList(String tenantId, List<DictDataDTO> value);

    /**
     *  获取集合
     * @param tenantId
     * @return
     */
    @Cacheable(cacheNames = "SAMPLE_TEST2", key = "#tenantId")
    List<DictDataDTO> getList(String tenantId);

}
